/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pe.edu.upc.dew.sisrest.controller;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import pe.edu.upc.dew.sisrest.model.Evento;
import pe.edu.upc.dew.sisrest.service.EventoManager;

/**
 *
 * @author u201014509
 */

@Controller
public class EventoController {

    EventoManager eventoManager;

    @Autowired
    public EventoController(EventoManager eventoManager){
        this.eventoManager=eventoManager;
    }

    @RequestMapping("/adm_eventos.htm")
    public void adm_eventos(Model model, @ModelAttribute("Evento") Evento evento) {
		List<Evento> eventos = eventoManager.obtenerEventos();
                model.addAttribute("eventos", eventos);
                model.addAttribute("evento", evento);
    }
}
